<?php
// +----------------------------------------------------------------------
// | ZGUAN [ 致力于帮助更多的中小企业实现低成本数字化转型 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2024 https://www.zguan.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ZGUAN 并不是自由软件，未经许可不能去掉ZGUAN 相关版权
// +----------------------------------------------------------------------
// | Author: ZGUAN Team <admin@zguan.cn>  0769-82282996  15899929162
// +----------------------------------------------------------------------
namespace app\validate\room;

use think\Validate;

class RoomOwnerValidate extends Validate
{
    protected $rule = [
        'property_id|物业信息' => 'require|number',
        'room_id|房屋信息' => 'require|number',
        'username|业主姓名' => 'require',
        'mobile|联系电话' => 'require',
        'audit_status|审核状态' => 'require|in:1,3,9',
        'owner_type|身份类型' => 'require|in:1,2,3',
    ];

    public function sceneAdd()
    {
        return $this->remove('id', 'require');
    }

    public function sceneEdit()
    {
        return $this->remove('id', 'require')
            ->remove('room_id', 'require')
            ->remove('username', 'require')
            ->remove('mobile', 'require')
            ->remove('audit_status', 'require')
            ->remove('property_id', 'require');
    }

    public function sceneDel()
    {
        return $this->only(['id'])->append('id', 'require|number');
    }

    public function sceneAudit()
    {
        return $this->only(['audit_status', 'remark'])
            ->append('audit_status|审核状态', 'require|in:3,9')
            ->append('remark|备注说明', 'requireIf:audit_status,3');

    }
}